tmpDir = File.createTempDir()
def fileTreeBuilder = new FileTreeBuilder(tmpDir)

// main/submain/demo/test.txt
// 释放路径为系统临时目录下：类似 groovy-generated-1983560440256623873-tmpdir\main\submain\demo
fileTreeBuilder.dir('main') {
    dir('submain') {
        dir('demo'){
            file('test.txt', "println 'Hello world'")
        }
    }
}